package com.yilin.tms.core.entity.message;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yilin.tms.core.commons.base.BaseEntity;
import com.yilin.tms.core.commons.utils.SMSUtil;
import com.yilin.tms.core.commons.annotation.Explain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 短信发送记录
 *
 * @author zhangjinyuan
 * @date 2022/10/26
 */
@Entity
@Table(name = "message_sms_record")
@TableName(value = "message_sms_record")
public class SmsRecord extends BaseEntity {

    /**
     * 发送状态
     */
    public enum Status {
        fail(0, "失败"),
        success(1, "成功"),
        waitSend(2, "等待发送"),
        over(3, "过期");

        @EnumValue
        public Integer index;
        public String name;

        Status(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }
    //上级平台信息 直属运营平台
    @Column(name = "plat_id")
    private String platId;
    @Column(name = "plat_name")
    private String platName;

    @Explain("短信发送切入点全路径")
    @Column(name = "send_point")
    private String sendPoint;
    @Explain("文本内容")
    @Column(name = "content")
    private String content;
    @Explain("状态")
    @Column(name = "status")
    private Status status;
    @Explain("是否已经被用户取过")
    @Column(name = "is_received")
    private boolean isReceived;
    @Explain("接受者手机号码")
    @Column(name = "phone")
    private String phone;
    @Explain("短信类型")
    @Column(name = "msg_type")
    private SMSUtil.MsgType msgType;
    @Column(name = "code")
    private String code;
    @Column(name = "confirm_no")
    private String confirmNo;

    public String getPlatId() {
        return platId;
    }

    public void setPlatId(String platId) {
        this.platId = platId;
    }

    public String getPlatName() {
        return platName;
    }

    public void setPlatName(String platName) {
        this.platName = platName;
    }

    public String getSendPoint() {
        return sendPoint;
    }

    public void setSendPoint(String sendPoint) {
        this.sendPoint = sendPoint;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public boolean isReceived() {
        return isReceived;
    }

    public void setReceived(boolean received) {
        isReceived = received;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public SMSUtil.MsgType getMsgType() {
        return msgType;
    }

    public void setMsgType(SMSUtil.MsgType msgType) {
        this.msgType = msgType;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getConfirmNo() {
        return confirmNo;
    }

    public void setConfirmNo(String confirmNo) {
        this.confirmNo = confirmNo;
    }
}
